set(freetype_directory freetype-2.3.8)

if(CMAKEPORTS_ASSEMBLE)
    # This section is used only in CMakePorts SVN
    set(freetype_directory ${freetype_directory} PARENT_SCOPE)
    set(freetype_tarball   freetype-2.3.8.tar.gz PARENT_SCOPE)
    set(freetype_url http://downloads.sourceforge.net/freetype/freetype-2.3.8.tar.gz PARENT_SCOPE)
    set(freetype_patches
        freetype-2.3.8_cmp.diff
        PARENT_SCOPE)
endif()

if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${freetype_directory}")
    # suggestion: for use by ports as value to the DESTINATION key in the install() command
    set(CMP_ARCHIVE_OUTPUT_DIRECTORY lib)
    set(CMP_RUNTIME_OUTPUT_DIRECTORY bin)
    if(WIN32)
        set(CMP_LIBRARY_OUTPUT_DIRECTORY bin)
    else(WIN32)
        set(CMP_LIBRARY_OUTPUT_DIRECTORY lib)
    endif(WIN32)

    add_subdirectory(${freetype_directory})
endif()

# Compatibility settings for interoperability with FindFreetype.cmake
set(FREETYPE_FOUND 1 CACHE INTERNAL "Found Freetype")
set(FREETYPE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${freetype_directory}/src CACHE INTERNAL "Freetype include dir")
set(FREETYPE_LIBRARY   ${CMAKEPORTS_NAME_PREFIX}freetype CACHE INTERNAL "Freetype Library")
set(FREETYPE_LIBRARIES ${CMAKEPORTS_NAME_PREFIX}freetype CACHE INTERNAL "Freetype Libraries")
set(NATIVE_FREETYPE_LIB_PATH ${CMAKE_BINARY_DIR}/ports/freetype/${freetype_directory} CACHE INTERNAL "deprecated")
